<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<title>广州市来穗局移动门户</title>
<%@ include file="/common/taglibs.jsp" %>
<link href="${ctx}/common/css/common.css" type="text/css" rel="stylesheet" />
<script type="text/javascript">

	var ctx="${ctx}";  //全局路径
	var accessToken=localStorage.getItem("accessToken");
	//console.log("当前登录用户获得的accessToken是："+accessToken);
	var mainH;
	function addTab(title, url){
		if ($('#tt').tabs('exists', title)){
			$('#tt').tabs('select', title);
		} else {;
			var content = '<iframe scrolling="auto" frameborder="0"  src="'+url+"&accessToken="+accessToken+'" style="width:100%;height:'+mainH+'px;"></iframe>';
			$('#tt').tabs('add',{
				title:title,
				content:content,
				closable:true
			});
		}
	}
	
	/* 
	* 关闭并刷新新tab
	*/
	function closeAndRefreshTab(title) {
        $('#tt').tabs('close', title);
        var currTab =  $('#tt').tabs('getSelected'); //获得当前tab
        var content = $(currTab.panel('options').content);
        $("#tt").tabs('update',{
            tab: currTab,
            options:{
            	content: content
            }
        });
    };
	
	$(function(){
		mainH=($("#windowContainer").layout("panel","center").panel('options').height-38);
		var content = '<iframe scrolling="auto" frameborder="0"  src="" style="width:100%;height:'+mainH+';"></iframe>';
		$('#tt').tabs('add',{
			title:'图南软件',
			content:content,
			closable:true
		});
	})
	
	/* //调用封装的函数
	tooNanAjax("${ctx}/ajax/role/queryAll",null,null,null,function(data){
		//根据后台返回的data处理该模块事务逻辑
		console.log(data);
	});
	 */
</script>
</head>
<body id="windowContainer" class="easyui-layout">
	<div data-options="region:'north',border:false"
		style="height: 90px; padding: 0px; overflow: hidden">
	      <div class="top_container_logo"><img src="custom/image/page_logo.png" /></div> 
	      <div class="top_container_user">  <!-- 顶部右侧管理员操作容器 -->
	        	<div class="top_container_user_operations">  <!-- 顶部所有容器 -->
	            	<span class="top_container_user_operations_name" title="">
	            	<a style="display:block;" onclick="edit('winPassword',1)">图南管理员</a></span>
	                <span class="top_container_user_operations_qiuk_btn"><a href="#" onclick="closeLog();">退出</a></span>
	            </div>
	            <p>
	            	<label id="localtime"></label>
	            	<script>
						function showLocale(objD){ 
							var str; 
							var hh = objD.getHours(); 
							var mm = objD.getMinutes(); 
							var ss = objD.getSeconds(); 
							var month = objD.getMonth()+1;
							var date = objD.getDate();
							if(hh<10)hh='0'+hh; 
							if(mm<10)mm='0'+mm; 
							if(ss<10)ss='0'+ss; 
							if(month<10)month='0'+month;
							if(date<10)date = '0' + date;
							var year = objD.getFullYear();
							str=year+"年";
							str+=month+"月"+date+"日"+""; 
							str+= hh+":"+mm+":"+ss; 
							var today = new Array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');  
							var week = today[objD.getDay()]; 
							str+=" "+week;
							return(str); 
						} 
				
						function tick(){ 
							var today; 
							today=new Date(); 
							document.getElementById("localtime").innerHTML=showLocale(today); 
						} 
						window.setInterval("tick()",1000);
					</script>
	            </p>
	             <div >
                    <a target="center" href="" class="easyui-linkbutton" plain="true"
                        data-options="menu:'#mm',iconCls:'icon-first'" style="color:#fff;">首页</a>
                    <a href="javascript:void(0)" id="mb" class="easyui-menubutton"
                        data-options="menu:'#mm',iconCls:'icon-theme'" style="color:#fff;">更换主题</a>
                    <div id="mm" class="easyui-menu" data-options="onClick:menuHandler"
                        style="width: 120px;">
                        <div data-options="name:'default',iconCls:'icon-blue'">默认</div>
                        <div data-options="name:'gray' ,iconCls:'icon-default'">银灰色</div>
                        <div data-options="name:'metro-blue',iconCls:'icon-blue'">蓝色</div>
                        <div data-options="name:'metro-red',iconCls:'icon-red'">红色</div>
                        <div data-options="name:'metro-green',iconCls:'icon-green'">绿色</div>
                        <div data-options="name:'metro-orange',iconCls:'icon-orange'">橙色</div>
                    </div>
                    <script>
                    (function(){
                    	
                    	var token=localStorage["accessToken"];
                    	
                    	$("#mm").on({
                        	mouseover:function(){
                    			$(".l-btn-text").each(function(){
                    				if($(this).text()=="更换主题"){
                    						$(this).css("color","#333");
                    					}
                    				});
                    			},  
                        	mouseout:function(){
                    			$(".l-btn-text").each(function(){
                    				if($(this).text()=="更换主题"){
                    						$(this).css("color","#FFF");
                    					}
                    				});
                    			}, 
                        });
                    })();
					</script>
                </div>
           </div>
	</div>
	<%-- <div class="easyui-panel"
		data-options="region:'west',split:true,title:'&nbsp;&nbsp;&nbsp;&nbsp;菜单',iconCls:'icon-system'"
		style="width: 180px; overflow: hidden;">
		<div class="easyui-accordion"
			style="width: 100%; height: 100%; border: 0px;">
			<div title="&nbsp;&nbsp;&nbsp;&nbsp;业务管理" >
				<div class="nav-item">
					<a onclick="addTab('街镇管理','${ctx}/lsj/town/townList')"
						class="easyui-linkbutton"
						data-options="plain:true,iconCls:'icon-common'">&nbsp;&nbsp;&nbsp;街镇管理</a>
				</div>
			</div>
			<div title="&nbsp;&nbsp;&nbsp;&nbsp;系统管理" >
				<div class="nav-item">
					<a onclick="addTab('菜单管理','${ctx}/system/sysMenuList')"
						class="easyui-linkbutton"
						data-options="plain:true,iconCls:'icon-common'">&nbsp;&nbsp;&nbsp;菜单管理</a>
				</div>
				<div class="nav-item">
					<a  onclick="addTab('权限管理','${ctx}/system/sysMenuLinkList')"
						class="easyui-linkbutton" 
						data-options="plain:true,iconCls:'icon-common'">&nbsp;&nbsp;&nbsp;权限管理</a>
				</div>
				<div class="nav-item">
					<a  onclick="addTab('角色管理','${ctx}/system/sysRoleList')"
						class="easyui-linkbutton" 
						data-options="plain:true,iconCls:'icon-common'">&nbsp;&nbsp;&nbsp;角色管理</a>
				</div>
				<div class="nav-item">
					<a onclick="addTab('用户管理','${ctx}/system/sysUserList')"
						class="easyui-linkbutton" 
						data-options="plain:true,iconCls:'icon-common'">&nbsp;&nbsp;&nbsp;用户管理</a>
				</div>
				<div class="nav-item">
					<a onclick="addTab('数据字典','${ctx}/BscDicCode/index')"
						class="easyui-linkbutton" 
						data-options="plain:true,iconCls:'icon-common'">&nbsp;&nbsp;&nbsp;数据字典管理</a>
				</div>
			</div>
		</div>
	</div>  --%> 
	<div class="easyui-panel"
		data-options="region:'west',split:true,title:'&nbsp;&nbsp;菜单',iconCls:'icon-system'"
		style="width: 180px; overflow: hidden;">
		<div class="easyui-accordion"
			style="width: 100%; height: 100%; border: 0px;">
			<c:forEach var="item" items="${userMenu}">
				<div title="&nbsp;${item.menu.name}"
					data-options="iconCls:'${item.menu.menuIcon}'"
					style="text-align: center;">
					<c:forEach var="sub" items="${item.subMenus}">
						<c:choose>
							<c:when test="${empty sub.menuIcon}">
								<div class="nav-item">
								<c:choose>
								<c:when test="${empty sub.pageUrl}">
									<a target="center" onclick="updateBackgroundColor(this)"
										class="easyui-linkbutton" style="text-align: left;width: 90%"
										data-options="plain:true,iconCls:'icon-common'">&nbsp;${sub.name}</a>
								</c:when>
								<c:otherwise>
									<a target="center" onclick="addTab('${sub.name}','${ctx }/${sub.pageUrl}?menuId=${sub.id}')"
										class="easyui-linkbutton" style="text-align: left;width: 90%"
										data-options="plain:true,iconCls:'icon-common'">&nbsp;${sub.name}</a>
								</c:otherwise>
								</c:choose>
								</div>
							</c:when>
							<c:otherwise>
								<div class="nav-item">
									<c:choose>
									<c:when test="${empty sub.pageUrl}">
									<a target="center" onclick="updateBackgroundColor(this)"
										class="easyui-linkbutton" style="text-align: left;width: 90%"
										data-options="plain:true,iconCls:'${sub.menuIcon}'">&nbsp;${sub.name}</a>
									</c:when>
									<c:otherwise>
									<a target="center" onclick="addTab('${sub.name}','${ctx }/${sub.pageUrl}?menuId=${sub.id}')"
										class="easyui-linkbutton" style="text-align: left;width: 90%"
										data-options="plain:true,iconCls:'${sub.menuIcon}'">&nbsp;${sub.name}</a>
									</c:otherwise>
									</c:choose>
								</div>
							</c:otherwise>
						</c:choose>
					</c:forEach>
				</div>
			</c:forEach>
		</div>
	</div> 
	<div id="tt"  class="easyui-tabs" data-options="region:'center',title:''" style="padding: 0px; overflow: hidden">
			
	</div>
	<div data-options="region:'center',title:''" style="padding: 0px; overflow: hidden">
	<iframe src="" scrolling="no" frameborder="0" name="center"
		id="center" noresize="noresize" width="100%" height="99.5%"></iframe>
	</div>
	<div data-options="region:'south',border:false"
		style="height: 30px; padding: 10px; text-align: center; color:#fff;">
		技术支持：广州市图南软件科技有限公司</div>
</body>
</html>
